Conditions | 1 |
Paths | 1 |
Total Lines | 63 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 1 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | /*jslint |
||
38 | $(document).ready(function () { |
||
39 | 'use strict'; |
||
40 | |||
41 | $("#navbarBlog").click(function () { |
||
42 | trackAction("navbar.blog"); |
||
43 | }); |
||
44 | $("#navbarHelp").click(function () { |
||
45 | trackAction("navbar.help"); |
||
46 | }); |
||
47 | $("#navbarInfo").click(function () { |
||
48 | trackAction("navbar.info"); |
||
49 | }); |
||
50 | $("#navbarWhatsnew").click(function () { |
||
51 | trackAction("navbar.whatsnew"); |
||
52 | }); |
||
53 | |||
54 | $("#buttonExportGPX").click(function () { |
||
55 | trackAction("export.gpx"); |
||
56 | }); |
||
57 | |||
58 | $("#buttonPermalink").click(function () { |
||
59 | trackAction("permalink.create"); |
||
60 | }); |
||
61 | $("#buttonPermalinkShorten").click(function () { |
||
62 | trackAction("permalink.shorten"); |
||
63 | }); |
||
64 | |||
65 | $("#buttonMarkersNew1").click(function () { |
||
66 | trackMarker("new1"); |
||
67 | }); |
||
68 | $("#buttonMarkersDeleteAll1").click(function () { |
||
69 | trackMarker("deleteall1"); |
||
70 | }); |
||
71 | $("#buttonMarkersNew2").click(function () { |
||
72 | trackMarker("new2"); |
||
73 | }); |
||
74 | $("#buttonMarkersDeleteAll2").click(function () { |
||
75 | trackMarker("deleteall2"); |
||
76 | }); |
||
77 | |||
78 | $("#buttonLinesNew").click(function () { |
||
79 | trackLine("new"); |
||
80 | }); |
||
81 | $("#buttonLinesDeleteAll").click(function () { |
||
82 | trackLine("deleteall"); |
||
83 | }); |
||
84 | |||
85 | $("#sidebartoggle").click(function () { |
||
86 | trackAction("sidebar.toggle"); |
||
87 | }); |
||
88 | $("#hillshading").click(function () { |
||
89 | trackAction("hillshading.toggle"); |
||
90 | }); |
||
91 | $("#npa").click(function () { |
||
92 | trackAction("cdda.toggle"); |
||
93 | }); |
||
94 | $("#npa").click(function () { |
||
95 | trackAction("npa.toggle"); |
||
96 | }); |
||
97 | $("#geocaches").click(function () { |
||
98 | trackAction("geocaches.toggle"); |
||
99 | }); |
||
100 | }); |
||
101 |